package org.yu.team2023.flashdays.registries;

import com.google.common.collect.Multimap;
import net.minecraft.core.HolderLookup;
import net.minecraft.data.PackOutput;
import net.minecraft.tags.TagKey;
import net.minecraft.world.level.block.Block;
import net.minecraftforge.common.data.BlockTagsProvider;
import net.minecraftforge.common.data.ExistingFileHelper;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.concurrent.CompletableFuture;
import java.util.function.Supplier;

public class SimpleBlockTagProvider extends BlockTagsProvider {
    protected final Multimap<Supplier<? extends Block>, TagKey<Block>> pools;

    public SimpleBlockTagProvider(PackOutput output, CompletableFuture<HolderLookup.Provider> completableFuture, String modId, @Nullable ExistingFileHelper existingFileHelper, Multimap<Supplier<? extends Block>, TagKey<Block>> pools) {
        super(output, completableFuture, modId, existingFileHelper);
        this.pools = pools;
    }


    @Override
    protected void addTags(@NotNull HolderLookup.Provider provider) {
        pools.forEach((supplier, tagKey) -> tag(tagKey).add(supplier.get()));
    }
}
